home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ClockPrt.h
-
- Contains: xxx put contents here xxx
-
- Owned by: Richard Rodseth
-
- Copyright: © 1995 - 1996 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <3> 10/15/96 JP 1375124 : Used Active Part prop when
- recording.
- <2> 7/16/96 EL 1295068: Add dirty flag.
- <13> 10/23/95 RR #1291688 Added test for adding New menus
- <12> 9/12/95 RR Various activation problems. Added a
- floating window
- <11> 8/25/95 JP 1268279: Added frame to SendSetDataEvent
- <10> 8/15/95 RR HandleOSEvent takes Frame and Facet
- <9> 7/10/95 RR Misc. cleanup and bug fixes for shared
- window
- <8> 7/10/95 JP Scripting cleanup
- <7> 7/7/95 RR Some refactoring. Fix
- CreatePropObjSpecifier to deal with
- non-persistent frame. Set source frame of
- dialogs.
- <6> 6/28/95 RR 1242642 BB Mostly ref counting
- <5> 6/15/95 TJ Added Includes for compiling with out PCH
- <4> 6/13/95 JP Recordable Clock
- <3> 6/8/95 RR #1257260 Collapse base classes. #1214898
- StdTypes.r -> ODTypes.r
- <2> 6/3/95 TJ Added #includes for compile with out PCH
- <1> 5/31/95 RR first checked in
-
- To Do:
- */
-
- #ifndef _CLOCKPRT_
- #define _CLOCKPRT_
-
- #ifndef _WINUTILS_
- #include <WinUtils.h>
- #endif
-
- #ifndef SOM_ODStorageUnitView_xh
- #include <SUView.xh>
- #endif
-
- #ifndef _ORDCOLL_
- #include <OrdColl.h>
- #endif
-
- #ifndef SOM_ODSession_xh
- #include <ODSessn.xh>
- #endif
-
- #ifndef SOM_ODWindow_xh
- #include <Window.xh>
- #endif
-
- #ifndef SOM_ODMenuBar_xh
- #include <MenuBar.xh>
- #endif
-
- #ifndef SOM_ODShape_xh
- #include <Shape.xh>
- #endif
-
- class ClockPart;
- class ClockSI;
- class ClockFrame;
-
- //=========================================================================
- // Clock Part
- //=========================================================================
-
- class ClockPart
- {
- public:
- ClockPart();
- virtual ~ClockPart();
- void InitClockPart(Environment* ev,
- ODSession* session,
- ODPart* somSelf,
- ODPart* partWrapper);
-
- void PrepareStorage(Environment* ev, ODStorageUnit* storageUnit);
- void Release(Environment* ev);
- void ReleaseAll(Environment* ev);
- void Internalize(Environment* ev, ODStorageUnit* storageUnit);
- void Externalize(Environment* ev);
- void CloneInto(Environment *ev,
- ODDraftKey key,
- ODStorageUnit* storageUnit,
- ODFrame* scopeFrame);
-
- ODTypeToken CheckPresentation(Environment* ev, ODFrame* frame);
- // Makes sure the presentation is one of this part's known ones
-
- ClockFrame* CreateClockFrame(Environment* ev, ODFrame* frame, ODTypeToken presentation);
- // Creates a ClockFrame or descendent to attach as the part info
-
- void DisplayFrameAdded(Environment *ev, ODFrame* frame);
- void DisplayFrameConnected(Environment *ev, ODFrame* frame);
- void DisplayFrameRemoved(Environment *ev, ODFrame* frame);
- void DisplayFrameClosed(Environment *ev, ODFrame* frame);
- ODInfoType ReadPartInfo(Environment *ev,
- ODFrame* frame,
- ODStorageUnitView* storageUnitView);
-
- ODBoolean ContainsDisplayFrame(Environment* ev, ODFrame* frame);
- void AddContentFrame(Environment* ev, ODFrame* frame);
- void RemoveContentFrame(Environment* ev, ODFrame* frame);
-
- void BuildMenuBar(Environment* ev);
- void InstallMenus(Environment* ev);
- void OutlineSizeMenu(Environment *ev);
- void HandleFontMenu(Environment *ev, ODUShort item, ODFrame* frame);
- void HandleSizeMenu(Environment *ev, ODUShort item, ODFrame* frame);
- void HandleStyleMenu(Environment *ev, ODUShort item, ODFrame* frame);
-
- void ShowAboutBox(Environment* ev, ODFrame* frame);
- void ShowSynchDialog(Environment* ev);
- void NewFloater(Environment* ev, ODFrame* frame);
- void NewSinker(Environment* ev, ODFrame* frame);
-
- ODID OpenInitialWindow(Environment* ev);
- ODID OpenRootFrame(Environment* ev, ODFrame* frame);
- void GetDefaultWindowProperties(Environment* ev, WindowProperties* props, ODFrame* sourceFrame);
- ODPlatformWindow CreatePlatformWindow(WindowProperties& props);
- ODWindow* CreateWindow(Environment *ev, WindowProperties& props, ODFrame* rootFrame);
-
- void CalcClockBounds(Rect& rect);
- void Idle(Environment* ev, ODEventData* event) { };
- void AdjustMenus(Environment* ev);
- ODBoolean HandleMenuEvent(Environment* ev, ODEventData* event, ODFrame* frame);
-
- ODBoolean CloseWindow(Environment* ev, ODFrame* frame);
-
- ODMenuBar* GetMenuBar() { return fMenuBar; };
-
- ODSShort GetFont() { return fFont; }
-
- ODSShort GetSize() { return fSize; }
-
- ODUByte GetStyle() { return fStyle; }
-
- ODSession* GetSession() { return fSession; }
-
- ClockSI* AquireSI(Environment* ev);
- void CreatePropObjSpec(Environment* ev, DescType prop, AEDesc& objSpec);
- void SendSetDataEvent(Environment* ev, AEDesc& objSpec, AEDesc& data, ODFrame* frame);
- void SendClockModeEvent(Environment *ev, ODBoolean analog, ODFrame* frame);
- ODFrame* GetFirstFrame();
-
- void SetFont(Environment *ev, ODSShort fontNum);
- void SetFontSize(Environment *ev, ODSShort fontSize);
- void SetFontStyle(Environment *ev, ODUByte fontStyle);
-
- ODSShort GetLastAscent() { return fLastAscent;};
- void SetLastAscent(ODSShort ascent) { fLastAscent = ascent;};
-
- ODPart* GetPartWrapper() { return fPartWrapper; };
-
- ODBoolean AlarmEnabled() { return fAlarmEnabled; };
- void ToggleAlarm() { fAlarmEnabled = !fAlarmEnabled; };
-
- ODBoolean IsAnalog() { return fAnalog; };
- void SetAnalog(Environment* ev, ODBoolean analog);
-
- ODShape* CreateOvalShape(Environment* ev, ODFrame* frame, Rect& rect);
-
- void AdjustDisplayFrames(Environment* ev);
- void AdjustDialogs(Environment* ev);
-
- ODBoolean HandleOSEvent(Environment* ev, ODEventData* event, ODFrame* frame, ODFacet* facet);
-
- public: // Tokenized strings
-
- ODTypeToken fFrameView;
- ODTypeToken fTimePresentation;
- ODTypeToken fDisplaySettingsPresentation;
- ODTypeToken fAlarmSettingsPresentation;
- ODTypeToken fSynchronizePresentation;
- ODTypeToken fDialogPresentation;
-
-
- private: // With inline accessors
- ODMenuBar* fMenuBar;
- ODSShort fFont; // text font
- ODSShort fSize; // text size
- ODUByte fStyle; // text style
- ODSShort fLastAscent; // font ascent
- ODBoolean fAlarmEnabled;
- ODBoolean fAnalog;
- ODSession* fSession;
- ODBoolean fDirty;
- private:
- ODPart* fPartWrapper;
- ODArbitrator* fArbitrator;
- ODDispatcher* fDispatcher;
- ODWindowState* fWindowState;
- ClockSI* fSemanticInterface;
-
- ODPart* fSOMSelf;
- ODStorageUnit* fTestClockSU;
- OrderedCollection* fContentFrames;
-
- WindowPtr fWorkPort;
- MenuHandle fFontMenu;
- MenuHandle fSizeMenu;
- MenuHandle fStyleMenu;
- MenuHandle fSettingsMenu;
- MenuHandle fViewMenu;
- MenuHandle fExtraMenu;
- MenuHandle fExtraSubMenu;
- ODTypeToken fModalFocus;
- };
-
- #endif // _CLOCKPRT_
-